<template>
  <div class="app-container" v-loading="pageLoading">
    <el-button type="primary" class="fr" v-permission='"ordertype.add"' @click="createItem">创建</el-button>
    <div class="filter-container">
      <el-input style="width: 300px" placeholder="输入查询条件按回车" clearable prefix-icon="el-icon-search" class="filter-item"
        @keyup.enter.native="research" @clear="research" v-model="query.queryString"></el-input>
      <el-button class="filter-item" type="success" plain @click="research">查询</el-button>
      <el-button class="filter-item" type="info" plain @click="exportData" :loading="exportLoading">导出 </el-button>
    </div>
    <z-table :list="list" :tableProps="tableProps" :columns="columns" @editItem="editItem" @deleteItem="deleteItem">
    </z-table>
    <z-pagination :pagination="pagination" :total="total" :page.sync="query.page" :limit.sync="query.size"
      @change="getList"></z-pagination>
    <z-form-dialog :name="name" :data="data" :formProps="formProps" :fields="fields" @submit="submit"
      :submitLoading="submitLoading" :visible.sync="editFormVisible"></z-form-dialog>
  </div>
</template>

<script>
import commonMixin from '@/views/_common/mixin'
export default {
  mixins: [commonMixin],
  name: 'ordertype',
  data: function () {
    return {
      api: this.$api.ordertype,
      apiEdit: this.$api.ordertype + 'add',
      name: '单据类型管理',
      columns: [
        { title: '单据CODE', key: 'code', width: 200 },
        { title: '单据名称', key: 'name', width: 200 },
        { title: 'ERP单据', key: 'erp_code' },
        { title: '修改人', key: 'modify_user', width: 100 },
        { title: '最后修改', key: 'modify_time', width: 140 },
      ],
      fields: [
        { title: '单据名称', key: 'name', required: true },
        { title: '单据CODE', key: 'code', required: true },
        { title: 'ERP单据', key: 'erp_code' },
        { title: '备注', key: 'remarks' },
      ],
    }
  },
  methods: {},
  created: function () {
    this.getList()
  },
}
</script>
<style scoped>
</style>
